<?php
// Chargement de la biblioteque
require_once('bph_load.php');

// Creation de la page
$page=new BphHtml('bph_demo');
$page->author = 'Bruno paulin';
$page->title = 'bph_demo_form';
$page->AddCss('bph_form.css');
$page->SetDebug();

$form = new BphForm('form1', 'form.php');
$fieldset1 = new BphFieldSet('legende fieldset1', 'form1', True);


$text1 = new BphFText('text1');
$text1->SetHelp('label text1', 'Aide label text1');
$text1->value = 'valeur';
$fieldset1->AddItems($text1);

$text2 = new BphFText('text2');
$text2->SetHelp('label text2', 'Aide label text2', 'exemple2');
$text2->SetLimit(5);
$fieldset1->AddItems($text2);

$hidden1 = new BphFHidden('hidden1');
$hidden1->value = 'valeur hidden1';
$fieldset1->AddItems($hidden1);

$pass1 = new BphFPassword('pass1');
$pass1->SetHelp('label pass1', 'Aide label pass1');
$fieldset1->AddItems($pass1);

$number1 = new BphFNumber('number1');
$number1->SetLimit(-10,10,2);
$number1->value = '8';
$number1->SetHelp('label number1', 'Aide label number1');
$fieldset1->AddItems($number1);


$area1 = new BphFTextArea('area1');
$area1->SetHelp('label area1', 'Aide label area1');
$area1->SetSize(20, 10);
$area1->value = "val''eu<br>r\n
valeur";
$fieldset1->AddItems($area1);

$tel1 = new BphFTel('tel1');
$tel1->SetHelp('label tel1', 'Aide label tel1');
$fieldset1->AddItems($tel1);

$mail1 = new BphFEmail('mail1');
$mail1->SetHelp('label mail1', 'Aide label mail1');
$fieldset1->AddItems($mail1);

$url1 = new BphFUrl('url1');
$url1->SetHelp('label url1', 'Aide label url1');
$fieldset1->AddItems($url1);

$search1 = new BphFSearch('search1');
$search1->SetHelp('label search1', 'Aide label search1');
$fieldset1->AddItems($search1);

$file1 = new BphFFile('file1');
$file1->SetHelp('label file1', 'Aide label file1');
$fieldset1->AddItems($file1);

$select1 = new BphFRadio('select1', True, 5);
$select1->SetHelp('label select1', 'Aide label select1');
for ($i = 0; $i < 5; $i++){
	$group = $select1->NewGroup("group$i", True);
	for ($j = 0; $j < 5; $j++){
		$group->AddOption("option $i-$j", "$i-$j", False, (rand(0,1)>=.5));
	}
}
for ($i = 0; $i < 5; $i++){
	$select1->AddOption("option $i", "$i");
}
$fieldset1->AddItems($select1);

$actions = new BphFAction(False);
$actions->AddSubmit('submit text', 'help submit', 'submit1');
$actions->AddReset('reset text', 'help reset', 'reset1');
$actions->AddButton('nothing', 'help nothing', 'nothing1');
$actions->SetHelp('label actions', 'Aide actions');

$form->AddItems($fieldset1, $actions);
$page->AddItems($form);
echo $page->Code();
?>
